import React, { PureComponent, createContext, forwardRef } from 'react'
import Topdiv from './styTopDiv'

export default class Test extends PureComponent {
  constructor(props) {
    super(props)
    this.state = {
      bgc: 'blue',
    }
  }
  render() {
    return (
      <>
        <div>Test</div>
        <button onClick={() => this.changeBgc()}>点击改变颜色</button>
        <hr />
        <Topdiv bgc={this.state.bgc}>
          <p>aaa</p>
        </Topdiv>
      </>
    )
  }
  changeBgc() {
    this.setState({
      bgc: this.state.bgc === 'blue' ? 'yellow' : 'blue',
    })
  }
}
